# 1 * 2 * 3 = ??
# 1 * 2 * 3 * 4 = ??
# 1 * 2 * 3 * 4 * 5 = ??
# Until ........* 10 = ???

# Task 0: Print only the results
total = 1
adder = 1

while adder <= 10:
    total *= adder
    print(f'{total}')
    adder += 1

print("-----------------------------------------------------")
# Task 1: Print the formulas and the results
total = 1
adder = 1
formula = '1'
while adder <= 10:
    total *= adder
    formula += f' * {adder}'
    print(f'{formula} = {total}')
    adder += 1


print("-----------------------------------------------------")
# Task 2: Can you print the results backwards?
adder = 10

while adder >= 1:
    adder_1 = 1
    total = 1
    while adder_1 <= adder:
        total *= adder_1
        adder_1 += 1
    print(total)
    adder -= 1

print("-----------------------------------------------------")
# Task 3: Can you print the formulas and the results backwards?
adder = 10

while adder >= 1:
    adder_1 = 1
    total = 1
    formula = '1'
    while adder_1 <= adder:
        total *= adder_1
        formula += f' * {adder_1}'
        adder_1 += 1
    print(f'{formula} = {total}')
    adder -= 1

print("-----------------------------------------------------")
# Task 4: Can you print the formulas and the results backwards and plus the last multiplier?
adder = 10  # 从10开始，每次减1
while adder >= 1:  #
    # adder为当前循环最大乘数
    adder_1 = 1  # 为第二层循环做准备，当前乘数设置为1
    total = 1  # 为第二层循环做准备，总乘积为1
    formula = '1'  # 为第二层循环做准备，乘积公式设置为"1"
    while adder_1 <= adder:
        total *= adder_1  # 总乘积乘当前乘数
        formula += f' * {adder_1}'  # 乘积公式
        adder_1 += 1  # 当前乘数+1
    total += adder  # 总结果 += 当前循环最大乘数
    formula += f" + {adder}"  # 公式 += " + 当前循环最大乘数 "
    print(f'{formula} = {total}')
    adder -= 1  # 当前循环最大乘数-=1
